\hypertarget{classBTree}{}\doxysection{B\+Tree$<$ T $>$ Class Template Reference}
\label{classBTree}\index{BTree$<$ T $>$@{BTree$<$ T $>$}}


这是\+B树的实现，内部有一个\+B\+T\+Node作为其结点，\+B\+Tree实际上就是一个unique\+\_\+ptr$<$\+B\+T\+Node$>$ 另外，这个\+B树是很好的扩展，可以根据传入的\+T（key）进行不同的处理，只要重载了operator ==，$<$,$>$就可以很好的运用了 也可以修改一下search，以及外部结点，就可以变成\+B+树  




{\ttfamily \#include $<$B\+Tree.\+h$>$}

\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classBTree_abfd9897f4a7450a38b87269cea42e181}\label{classBTree_abfd9897f4a7450a38b87269cea42e181}} 
using {\bfseries B\+T\+Node\+Ptr} = std\+::unique\+\_\+ptr$<$ B\+T\+Node $>$
\item 
\mbox{\Hypertarget{classBTree_a35304054da7f8cab8bb9cf29e480e4bc}\label{classBTree_a35304054da7f8cab8bb9cf29e480e4bc}} 
using {\bfseries B\+T\+Node\+Posi} = B\+T\+Node $\ast$
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classBTree_a9fc26aa50dd71d0892fe79a5e4fc7db7}{B\+Tree}} (int order=3)
\begin{DoxyCompactList}\small\item\em 创建一颗度为order的\+B树 \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classBTree_ad247a72b7f190d515d268ea9b991ba75}\label{classBTree_ad247a72b7f190d515d268ea9b991ba75}} 
{\bfseries B\+Tree} (const \mbox{\hyperlink{classBTree}{B\+Tree}} \&)=delete
\item 
\mbox{\Hypertarget{classBTree_a2a3fd1a4079b81a35e9a5df3315fe444}\label{classBTree_a2a3fd1a4079b81a35e9a5df3315fe444}} 
\mbox{\hyperlink{classBTree}{B\+Tree}} \& {\bfseries operator=} (const \mbox{\hyperlink{classBTree}{B\+Tree}} \&)=delete
\item 
\mbox{\Hypertarget{classBTree_a56610295adaa49cbb15b2c91b86f6238}\label{classBTree_a56610295adaa49cbb15b2c91b86f6238}} 
int {\bfseries order} () const
\item 
\mbox{\Hypertarget{classBTree_ab8a7c8c8ae2c02583edfacc660fbc0a7}\label{classBTree_ab8a7c8c8ae2c02583edfacc660fbc0a7}} 
int {\bfseries size} () const
\item 
\mbox{\Hypertarget{classBTree_a08d5aae9839efabbd29314669d28d5b8}\label{classBTree_a08d5aae9839efabbd29314669d28d5b8}} 
bool {\bfseries empty} () const
\item 
\mbox{\Hypertarget{classBTree_ae8216bdb6edd418fc5d1444791a382e2}\label{classBTree_ae8216bdb6edd418fc5d1444791a382e2}} 
B\+T\+Node\+Posi {\bfseries root} () const
\item 
B\+T\+Node\+Posi \mbox{\hyperlink{classBTree_abef4d3b58f15a705a8160360d2cd60ec}{search}} (const T \&e)
\begin{DoxyCompactList}\small\item\em 搜索值为e的结点，返回其地址，如果搜不到则返回nullptr \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classBTree_ad0a275883210c05d4af1644f45128f18}{insert}} (const T \&e)
\begin{DoxyCompactList}\small\item\em 插入key为e的结点，返回\+True， \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classBTree_aff6835ad66ba5115ae28b2c21b328f51}{remove}} (const T \&e)
\begin{DoxyCompactList}\small\item\em 从\+B\+Tree树中删除关键码e 真正删除的节点一定是一个叶子节点，即便e的key不是叶子， 我们也可以通过交换并删除它的后继来达到此效果 \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classBTree_a3040e0a49ee348cae331deaf184bc5f2}\label{classBTree_a3040e0a49ee348cae331deaf184bc5f2}} 
int {\bfseries size} ()
\item 
\mbox{\Hypertarget{classBTree_a8f8c4e3af810c4c48e5f17f4831a81ca}\label{classBTree_a8f8c4e3af810c4c48e5f17f4831a81ca}} 
{\bfseries B\+Tree} (int \+\_\+t)
\item 
\mbox{\Hypertarget{classBTree_a8535f16ff64c0de5c41d789bb386af7c}\label{classBTree_a8535f16ff64c0de5c41d789bb386af7c}} 
void {\bfseries traverse} ()
\item 
\mbox{\Hypertarget{classBTree_a8e5d2d87a8a1f53110f84772e60eeda0}\label{classBTree_a8e5d2d87a8a1f53110f84772e60eeda0}} 
\mbox{\hyperlink{classBTreeNode}{B\+Tree\+Node}} $\ast$ {\bfseries search} (int k)
\item 
\mbox{\Hypertarget{classBTree_a7da804e6d1ec0a11995c39471c903a65}\label{classBTree_a7da804e6d1ec0a11995c39471c903a65}} 
void {\bfseries insert} (int k)
\item 
\mbox{\Hypertarget{classBTree_a9fc1221f58abaeadafd06c3c9c4ec386}\label{classBTree_a9fc1221f58abaeadafd06c3c9c4ec386}} 
void {\bfseries remove} (int k)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\subsubsection*{template$<$class T$>$\newline
class B\+Tree$<$ T $>$}

这是\+B树的实现，内部有一个\+B\+T\+Node作为其结点，\+B\+Tree实际上就是一个unique\+\_\+ptr$<$\+B\+T\+Node$>$ 另外，这个\+B树是很好的扩展，可以根据传入的\+T（key）进行不同的处理，只要重载了operator ==，$<$,$>$就可以很好的运用了 也可以修改一下search，以及外部结点，就可以变成\+B+树 



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classBTree_a9fc26aa50dd71d0892fe79a5e4fc7db7}\label{classBTree_a9fc26aa50dd71d0892fe79a5e4fc7db7}} 
\index{BTree$<$ T $>$@{BTree$<$ T $>$}!BTree@{BTree}}
\index{BTree@{BTree}!BTree$<$ T $>$@{BTree$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{BTree()}{BTree()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
\mbox{\hyperlink{classBTree}{B\+Tree}}$<$ T $>$\+::\mbox{\hyperlink{classBTree}{B\+Tree}} (\begin{DoxyParamCaption}\item[{int}]{order = {\ttfamily 3} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



创建一颗度为order的\+B树 


\begin{DoxyParams}{Parameters}
{\em order} & \\
\hline
\end{DoxyParams}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classBTree_ad0a275883210c05d4af1644f45128f18}\label{classBTree_ad0a275883210c05d4af1644f45128f18}} 
\index{BTree$<$ T $>$@{BTree$<$ T $>$}!insert@{insert}}
\index{insert@{insert}!BTree$<$ T $>$@{BTree$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{insert()}{insert()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
bool \mbox{\hyperlink{classBTree}{B\+Tree}}$<$ T $>$\+::insert (\begin{DoxyParamCaption}\item[{const T \&}]{e }\end{DoxyParamCaption})}



插入key为e的结点，返回\+True， 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em e} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true 插入成功 

false 如果结点已经存在，因为不支持重复插入那么返回false 
\end{DoxyReturn}
\mbox{\Hypertarget{classBTree_aff6835ad66ba5115ae28b2c21b328f51}\label{classBTree_aff6835ad66ba5115ae28b2c21b328f51}} 
\index{BTree$<$ T $>$@{BTree$<$ T $>$}!remove@{remove}}
\index{remove@{remove}!BTree$<$ T $>$@{BTree$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{remove()}{remove()}}
{\footnotesize\ttfamily template$<$typename T $>$ \\
bool \mbox{\hyperlink{classBTree}{B\+Tree}}$<$ T $>$\+::remove (\begin{DoxyParamCaption}\item[{const T \&}]{e }\end{DoxyParamCaption})}



从\+B\+Tree树中删除关键码e 真正删除的节点一定是一个叶子节点，即便e的key不是叶子， 我们也可以通过交换并删除它的后继来达到此效果 


\begin{DoxyParams}{Parameters}
{\em e} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true 成功删除返回true 

false 找不到结点返回false 
\end{DoxyReturn}
\mbox{\Hypertarget{classBTree_abef4d3b58f15a705a8160360d2cd60ec}\label{classBTree_abef4d3b58f15a705a8160360d2cd60ec}} 
\index{BTree$<$ T $>$@{BTree$<$ T $>$}!search@{search}}
\index{search@{search}!BTree$<$ T $>$@{BTree$<$ T $>$}}
\doxysubsubsection{\texorpdfstring{search()}{search()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
\mbox{\hyperlink{classBTree}{B\+Tree}}$<$ T $>$\+::B\+T\+Node\+Posi \mbox{\hyperlink{classBTree}{B\+Tree}}$<$ T $>$\+::search (\begin{DoxyParamCaption}\item[{const T \&}]{e }\end{DoxyParamCaption})}



搜索值为e的结点，返回其地址，如果搜不到则返回nullptr 


\begin{DoxyTemplParams}{Template Parameters}
{\em T} & \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em e} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
B\+Tree$<$\+T$>$\+::\+B\+T\+Node\+Posi 
\end{DoxyReturn}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{BTree_8h}{B\+Tree.\+h}}\item 
t.\+cpp\end{DoxyCompactItemize}
